<?php

/**
 * 会员注册登录
 */
namespace User\Controller;

use Common\Controller\MemberbaseController;
use Org\Util\Date;

class JiangjinController extends MemberbaseController {
    //登录
    
	function _initialize(){
		parent::_initialize();
		
	}
	
	
	public function index() {

		{


			$map["uid"]=$this->u["id"];

			$count = D("JjLog")->where($map)->count();
			$page = $this->page ( $count, 20);
			$list =D("JjLog")->limit ( $page->firstRow . ',' . $page->listRows )->where($map)->order ( array (

				"id" => "DESC"
			) )->select ();

			$this->assign ( "Page", $page->show () );

			$this->assign("_list",$list);


			$this->assign ( "seo_title",  "奖金纪录 " );


			$this->display ();


		}




    }

    //退出



	function tixian(){


		$map["uid"]=$this->u["id"];

		$count = D("QbLog")->where($map)->count();
		$page = $this->page ( $count, 20);
		$list =D("QbLog")->limit ( $page->firstRow . ',' . $page->listRows )->where($map)->order ( array (

			"id" => "DESC"
		) )->select ();

		$this->assign ( "Page", $page->show () );

		$this->assign("_list",$list);


		$this->assign ( "seo_title",  "交易记录 " );


		$this->display ();


	}


	function  bangding(){

		if (IS_POST) {
			$code = I("post.code");

			if (empty($code)) {
				$this->error("验证码不能为空！");
			}

//			if ($code != session('code')) {
//				$this->error("验证码错误");
//
//			}


			if (!I('post.bank')) {
				$this->error("请选择银行");

			}

			if (!I('post.bank_card')) {
				$this->error("请填写银行卡号");

			}


			if (!I('post.bank_address')) {
				$this->error("请填写开户行名称");

			}

			if (!I('post.xingming')) {
				$this->error("请填写姓名");

			}



			$uid=$this->u["id"];

			$xingming=I('post.xingming');
			$data=array(

				"id"=>$uid,
				"bank"=>I('post.bank'),
				"bank_card"=>I('post.bank_card'),
				"bank_address"=>I('post.kaihuhang'),




			);
			if($xingming){
				$data["xingming"]=$xingming;
			}

			D("Users")->save($data);

			$this->success("绑定成功");


		}else{



			$this->display("bangding");
		}





	}





}
?>
